<script>
var currentScore = 5;
function star(n) {
	currentScore = n;
	obj = $('#stars');
	obj.removeClass();
	obj.addClass('stars');
	obj.addClass('s'+n);	
}
function scoreIt() {
	data = {'id':<?=$this->artist->id?>, 'score':currentScore};
	$.getJSON('/account/add-score', data, function(r) {
		  alert(r.message);
	});
}
</script>
<div id="pagepro" class="w920">
	<div class="jia">
		<h2><?=$this->artist->name?></h2>
		<ul>
			<?php
			$joinedUserCount = 0;
			$score = 0;
			foreach ($this->scores as $s) {
				$joinedUserCount++;
				$score += $s->score;
			}
			if ($joinedUserCount>0) {
				$score = ceil($score/$joinedUserCount);
			} else {
				$score = 5;
			}
			?>
			<li class="img"><img src="<?=$this->artist->getPhotoWebAccessablePath('130x130');?>" /></li>
			<li>ARTIST APPRAISAL</li>
			<li><span class="stars s<?=$score?>"></span></li>
			<li>(<?=$joinedUserCount?> users joined)</li>
			<li>
				<span class="stars s1" id="stars">
					<span style="margin-left:5px;overflow:hidden;display:inline;cursor:pointer;" onmouseover="star(1)">&nbsp;</span>
					<span style="margin-left:5px;overflow:hidden;display:inline;cursor:pointer;" onmouseover="star(2)">&nbsp;</span>
					<span style="margin-left:5px;overflow:hidden;display:inline;cursor:pointer;" onmouseover="star(3)">&nbsp;</span>
					<span style="margin-left:5px;overflow:hidden;display:inline;cursor:pointer;" onmouseover="star(4)">&nbsp;</span>
					<span style="margin-left:5px;overflow:hidden;display:inline;cursor:pointer;" onmouseover="star(5)">&nbsp;</span>
				</span>
			</li>
			<?php if ($this->currentUser) {?>
			<li><a href="javascript:scoreIt();">join the appraisal</a></li>
			<?php } else {?>
			<li><a href="javascript:alert('Please login.');">join the appraisal</a></li>
			<?php }?>
		</ul>
	</div>
	<div class="jj">
		<h2>RESUME</h2>
		<?if (strlen($this->artist->solo_exh)>10) {?>
		<p><b>Solo Exhibition: </b></p>
		<p><?=$this->artist->solo_exh?></p>
		<?php }?>
		<?if (strlen($this->artist->group_exh)>10) {?>
		<p><b>Group Exhibition: </b></p>
		<p><?=$this->artist->group_exh?></p>
		<?php }?>
		<?if (strlen($this->artist->education_background)>10) {?>
		<p><b>Education Background: </b></p>
		<p><?=$this->artist->education_background?></p>
		<?php }?>
	</div>
</div>

<div id="content" class="w920">
	<div class="conleft" style="border-right:1px solid #bcbec0;padding-right:0;width:720px;">
		<div class="pageysj">
			<dl>
				<dt>WORKS OF ART</dt>
				<dd>
					<ul class="pic">
					<?php foreach ($this->artworks as $artwork) {?>
						<li><a href="/artwork/show?id=<?=$artwork->id?>"><img src="<?=$artwork->getPhotoWebAccessablePath('70x70');?>" alt="<?=$this->escape($artwork->name)?>" /></a></li>
					<?php }?>
					</ul>
					<p class="more"><a href="/artwork?artist=<?=$this->artist->id?>">+More</a></p>
				</dd>
			</dl>
			<?php if (strlen($this->artist->resume)>10) {?>
			<dl>
				<dt>INTERVIEW:</dt>
				<dd>
					<p><? echo substr(strip_tags($this->artist->resume), 0, 500) . "...";?></p>
					<p class="more"><a href="/artists/interview/id/<?php echo $this->artist->id;?>" title="#">+More</a></p>
				</dd>
			</dl>
			<?php }?>
			<dl class="bt">
				<dt style="clear:both;">ART CRITICS SAY</dt>
				<p style="clear:both;"></p>
				<?php foreach ($this->criticises as $criticse) {?>
				<dd>
					<p><b><?=$criticse->reviewer?>:</b></p>
					<p><? echo substr(strip_tags($criticse->content), 0, 500) . "...";?></p>
					<p class="more"><a href="/critics/show/id/<?php echo $criticse->id;?>" title="#">+More</a></p>
				</dd>
				<?php }?>
			</dl>
		</div>
	</div>
	<?php echo $this->render('global/right_ad.phtml')?>
</div>